#ifndef IAP1DEF_H_
#define IAP1DEF_H_

#include "CIpodLib.h"

#define MAX_IAP_PACKET_LEN                              0xFFFC

/**************************************************************************************
 * Section: Lingo ID define
 **************************************************************************************/

typedef unsigned char SLingoType;

#define SL_GENERAL                                      0x00
#define SL_MICROPHONE                                   0x01
#define SL_SIMPLE_REMOTE                                0x02
#define SL_DISPLAY_REMOTE                               0x03
#define SL_REMOTE_UI_EXTENDED                           0x04
#define SL_EXTENDED_INTERFACE                           0x04
#define SL_DIGITAL_AUDIO                                0x0A

typedef unsigned int MLingoType;

#define ML_GENERAL                                      0x0001
#define ML_MICROPHONE                                   0x0002
#define ML_SIMPLE_REMOTE                                0x0004
#define ML_DISPLAY_REMOTE                               0x0008
#define ML_REMOTE_UI_EXTENDED                           0x0010
#define ML_ACCESSORY_POWER                              0x0020
#define ML_USB_HOST_CONTROL                             0x0040
#define ML_RF_TRANSMITTER                               0x0080
#define ML_ACCESSORY_EQ                                 0x0100
#define ML_DIGITAL_AUDIO                                0x0400
#define ML_STORAGE                                      0x1000

/**************************************************************************************
 * Section: General Lingo Commands
 **************************************************************************************/

#define GL_REQ_INDENTIFY                                0x00
#define GL_IPOD_ACK                                     0x02
#define GL_REQ_EXT_INTERFACE_MODE                       0x03
#define GL_RET_EXT_INTERFACE_MODE                       0x04
#define GL_ENTER_EXTENDED_INTERFACE_MODE                0x05
#define GL_EXIT_EXT_INTERFACE_MODE                      0x06
#define GL_REQ_IPOD_NAME                                0x07
#define GL_RET_IPOD_NAME                                0x08
#define GL_REQ_IPOD_SOFT_VERSION                        0x09
#define GL_RET_IPOD_SOFT_VERSION                        0x0A
#define GL_REQ_IPOD_SOFT_SERIAL_NUM                     0x0B
#define GL_RET_IPOD_SOFT_SERIAL_NUM                     0x0C
#define GL_REQ_LINGO_PROTOC_VER                         0x0F
#define GL_RET_LINGO_PROTOC_VER                         0x10
#define GL_REQ_TANS_MAX_PAYLOAD_SIZE                    0x11
#define GL_RET_TANS_MAX_PAYLOAD_SIZE                    0x12
#define GL_INDENTIFY_DEV_LINGO                          0x13
#define GL_GET_ACC_AUTH_INFO                            0x14
#define GL_RET_ACC_AUTH_INFO                            0x15
#define GL_ACK_ACC_AUTH_INFO                            0x16
#define GL_GET_ACC_AUTH_SIGN                            0x17
#define GL_RET_ACC_AUTH_SIGN                            0x18
#define GL_ACK_ACC_AUTH_SIGN                            0x19
#define GL_GET_IPOD_AUTH_SIGN                           0x1A
#define GL_RET_IPOD_AUTH_SIGNO                          0x1B
#define GL_ACK_IPOD_AUTH_SIGN                           0x1C
#define GL_GET_IPOD_AUTH_INFO                           0x1D
#define GL_RET_IPOD_AUTH_INFO                           0x1E
#define GL_ACK_IPOD_AUTH_INFO                           0x1F
#define GL_NOTIFY_IPOD_STATE_CHANGE                     0x23
#define GL_GET_IPOD_OPTION                              0x24
#define GL_RET_IPOD_OPTION                              0x25
#define GL_GET_ACC_OPTION                               0x27
#define GL_RET_ACC_OPTION                               0x28
#define GL_GET_IPOD_PREFER                              0x29
#define GL_RET_IPOD_PREFER                              0x2A
#define GL_SET_IPOD_PREFER                              0x2B
#define GL_GET_UI_MODE                                  0x35
#define GL_RET_UI_MODE                                  0x36
#define GL_SET_UI_MODE                                  0x37
#define GL_START_IDPS                                   0x38
#define GL_SET_FID_TOKEN_VALUE                          0x39
#define GL_ACK_FID_TOKEN_VALUE                          0x3A
#define GL_END_IDPS                                     0x3B
#define GL_IDPS_STATUS                                  0x3C
#define GL_OPEN_DATA_SESSION_FOR_PROT                   0x3F
#define GL_CLOSE_DATA_SESSION                           0x40
#define GL_ACC_ACK                                      0x41
#define GL_ACC_DATA_TRANSFER                            0x42
#define GL_IPOD_DATA_TRANSFER                           0x43
#define GL_SET_ACC_STATUS_NOTIFIY                       0x46
#define GL_RET_ACC_STATUS_NOTIFIY                       0x47
#define GL_ACC_STATUS_NOTIFIY                           0x48
#define GL_SET_EVENT_NOTIFIY                            0x49
#define GL_IPOD_NOTIFIY                                 0x4A
#define GL_GET_IPOD_OPTIONS_FOR_LINGO                   0x4B
#define GL_RET_IPOD_OPTIONS_FOR_LINGO                   0x4C
#define GL_GET_EVENT_NOTIFIY                            0x4D
#define GL_RET_EVENT_NOTIFIY                            0x4E
#define GL_GET_SUPPORT_EVENT_NOTIFIY                    0x4F
#define GL_CANCEL_COMMAND                               0x50
#define GL_RET_SUPPORT_EVENT_NOTIFIY                    0x51
#define GL_SET_AVAILABLE_CURRENT                        0x54
#define GL_SET_INTERAL_BATT_CHARG_STATE                 0x56
#define GL_REQ_APP_LAUNCH                               0x64
#define GL_GET_NOW_PLAY_APP_NAME                        0x65
#define GL_RET_NOW_PLAY_APP_NAME                        0x66
#define GL_GET_LOCAL_INFO                               0x67
#define GL_RET_LOCAL_INFO                               0x68
#define GL_REQ_WIFI_CONNECT_INFO                        0x69
#define GL_RET_WIFI_CONNECT_INFO                        0x6A

/**************************************************************************************
 * Section: Extended Interface Mode Commands
 **************************************************************************************/

#define EIL_IPOD_ACK                                    0x0001
#define EIL_GET_CURRENT_PLAYING_TRACK_CHAPTERINFO       0x0002
#define EIL_RET_CURRENT_PLAYING_TRACK_CHAPTERINFO       0x0003
#define EIL_SetCurrentPlayingTrackChapter               0x0004
#define EIL_GetCurrentPlayingTrackChapterPlayStatus     0x0005
#define EIL_ReturnCurrentPlayingTrackChapterPlayStatus  0x0006
#define EIL_GetCurrentPlayingTrackChapterName           0x0007
#define EIL_ReturnCurrentPlayingTrackChapterName        0x0008
#define EIL_GetAudiobookSpeed                           0x0009
#define EIL_ReturnAudiobookSpeed                        0x000A
#define EIL_SetAudiobookSpeed                           0x000B
#define EIL_GetIndexedPlayingTrackInfo                  0x000C
#define EIL_ReturnIndexedPlayingTrackInfo               0x000D
#define EIL_GetArtworkFormats                           0x000E
#define EIL_RetArtworkFormats                           0x000F
#define EIL_GetTrackArtworkData                         0x0010
#define EIL_RetTrackArtworkData                         0x0011
#define EIL_RESET_DB_SECTION                            0x0016
#define EIL_SELECT_DB_SECTION                           0x0017
#define EIL_GET_NUMBER_CATEGORIZED_DBRECORDS            0x0018
#define EIL_RET_NUMBER_CATEGORIZED_DBRECORDS            0x0019
#define EIL_RETRIEVE_CATEGORIZED_DBRECORDS              0x001A
#define EIL_RETURN_CATEGORIZED_DBRECORDS                0x001B
#define EIL_GET_PLAY_STATUS                             0x001C
#define EIL_RETURN_PLAY_STATUS                          0x001D
#define EIL_GET_PLAYING_TRACK_INDEX                     0x001E
#define EIL_RET_PLAYING_TRACK_INDEX                     0x001F
#define EIL_GET_INDEX_PLAYING_TRACK_TITLE               0x0020
#define EIL_RET_INDEX_PLAYING_TRACK_TITLE               0x0021
#define EIL_GET_INDEX_PLAYING_TRACK_ARTIS_NAME          0x0022
#define EIL_RET_INDEX_PLAYING_TRACK_ARTIS_NAME          0x0023
#define EIL_GET_INDEX_PLAYING_TRACK_ALBUM_NAME          0x0024
#define EIL_RET_INDEX_PLAYING_TRACK_ALBUM_NAME          0x0025
#define EIL_SET_PLAY_STATUS_CHANGE_NOTIFICATION         0x0026
#define EIL_PLAY_STATUS_CHANGE_NOTIFICATION             0x0027
#define EIL_PLAY_CONTRAL                                0x0029
#define EIL_GET_TRACK_ARTWORK_TIMES                     0x002A
#define EIL_RET_TRACK_ARTWORK_TIMES                     0x002B
#define EIL_GET_SHUFFLE                                 0x002C
#define EIL_RET_SHUFFLE                                 0x002D
#define EIL_SET_SHUFFLE                                 0x002E
#define EIL_GET_REPEAT                                  0x002F
#define EIL_RET_REPEAT                                  0x0030
#define EIL_SET_REPEAT                                  0x0031
#define EIL_SET_DISPALY_IMAGE                           0x0032
#define EIL_GetMonoDisplayImageLimits                   0x0033
#define EIL_ReturnMonoDisplayImageLimits                0x0034
#define EIL_GetNumPlayingTracks                         0x0035
#define EIL_ReturnNumPlayingTracks                      0x0036
#define EIL_SetCurrentPlayingTrack                      0x0037
#define EIL_GetColorDisplayImageLimits                  0x0039
#define EIL_ReturnColorDisplayImageLimits               0x003A
#define EIL_RESET_DB_SECTION_HIERARCHY                  0x003B
#define EIL_GET_DB_ITUNES_INFO                          0x003C
#define EIL_RET_DB_ITUNES_INFO                          0x003D
#define EIL_GET_UID_TRACK_INFO                          0x003E
#define EIL_RET_UID_TRACK_INFO                          0x003F
#define EIL_GET_DB_TRACK_INFO                           0x0040
#define EIL_RET_DB_TRACK_INFO                           0x0041
#define EIL_GET_PB_TRACK_INFO                           0x0042
#define EIL_RET_PB_TRACK_INFO                           0x0043

/**************************************************************************************
 * Section: Display Remote Lingo Commands
 **************************************************************************************/

#define IPOD_DRL_iPodAck                                0x00
#define IPOD_DRL_GetCurrentEQProfileIndex               0x01
#define IPOD_DRL_RetCurrentEQProfileIndex               0x02
#define IPOD_DRL_SetCurrentEQProfileIndex               0x03
#define IPOD_DRL_GetNumEQProfiles                       0x04
#define IPOD_DRL_RetNumEQProfiles                       0x05
#define IPOD_DRL_GetIndexedEQProfileName                0x06
#define IPOD_DRL_RetIndexedEQProfileName                0x07
#define IPOD_DRL_SetRemoteEventNotification             0x08
#define IPOD_DRL_RemoteEventNotification                0x09
#define IPOD_DRL_GetRemoteEventStatus                   0x0A
#define IPOD_DRL_RetRemoteEventStatus                   0x0B
#define IPOD_DRL_GetiPodStateInfo                       0x0C
#define IPOD_DRL_RetiPodStateInfo                       0x0D
#define IPOD_DRL_SetiPodStateInfo                       0x0E
#define IPOD_DRL_GetPlayStatus                          0x0F
#define IPOD_DRL_RetPlayStatus                          0x10
#define IPOD_DRL_SetCurrentPlayingTrack                 0x11
#define IPOD_DRL_GetIndexedPlayingTrackInfo             0x12
#define IPOD_DRL_RetIndexedPlayingTrackInfo             0x13
#define IPOD_DRL_GetNumPlayingTracks                    0x14
#define IPOD_DRL_RetNumPlayingTracks                    0x15
#define IPOD_DRL_GetArtworkFormats                      0x16
#define IPOD_DRL_RetArtworkFormats                      0x17
#define IPOD_DRL_GetTrackArtworkData                    0x18
#define IPOD_DRL_RetTrackArtworkData                    0x19
#define IPOD_DRL_GetPowerBatteryState                   0x1A
#define IPOD_DRL_RetPowerBatteryState                   0x1B
#define IPOD_DRL_GetSoundCheckState                     0x1C
#define IPOD_DRL_RetSoundCheckState                     0x1D
#define IPOD_DRL_SetSoundCheckState                     0x1E
#define IPOD_DRL_GetTrackArtworkTimes                   0x1F
#define IPOD_DRL_RetTrackArtworkTimes                   0x20
#define IPOD_DRL_CreateGeniusPlaylist                   0x21
#define IPOD_DRL_IsGeniusAvailableForTrack              0x22

/**************************************************************************************
 * Section: Digital Audio Lingo Commands
 **************************************************************************************/

#define DAL_ACC_ACK                                     0x00
#define DAL_IPOD_ACK                                    0x01
#define DAL_GET_ACC_SAMPLE_RATE_CAPS                    0x02
#define DAL_RET_ACC_SAMPLE_RATE_CAPS                    0x03
#define DAL_RET_TRACK_NEW_AUDIO_ATTR                    0x04
#define DAL_SET_VIDEO_DELAY                             0x05

/**************************************************************************************
 * Section: Sample Rate Lingo Commands
 **************************************************************************************/

#define IPOD_SRL_ContextButtonStatus                    0x00
#define IPOD_SRL_iPodAck                                0x01
#define IPOD_SRL_VideoButtonStatus                      0x03
#define IPOD_SRL_AudioButtonStatus                      0x04
#define IPOD_SRL_iPodOutButtonStatus                    0x0B
#define IPOD_SRL_RotationInputStatus                    0x0C
#define IPOD_SRL_RadioButtonStatus                      0x0D
#define IPOD_SRL_CameraButtonStatus                     0x0E
#define IPOD_SRL_RegisterDescriptor                     0x0F
#define IPOD_SRL_iPodHIDReport                          0x10
#define IPOD_SRL_AccessoryHIDReport                     0x11
#define IPOD_SRL_UnregisterDescriptor                   0x12
#define IPOD_SRL_VoiceOverEvent                         0x13
#define IPOD_SRL_GetVoiceOverParameter                  0x14
#define IPOD_SRL_RetVoiceOverParameter                  0x15
#define IPOD_SRL_SetVoiceOverParameter                  0x16
#define IPOD_SRL_GetCurrentItemVoiceOverProperty        0x17
#define IPOD_SRL_RetCurrentItemVoiceOverProperty        0x18
#define IPOD_SRL_SetVoiceOverContext                    0x19
#define IPOD_SRL_AccessoryACK                           0x81

/**************************************************************************************
 * Section: ACK Constants
 **************************************************************************************/

#define IPOD_ACK_SUCCESS                                0x00
#define IPOD_ACK_UNKNOWN_DATABASE_CATEGORY              0x01
#define IPOD_ACK_COMMAND_FAILED                         0x02
#define IPOD_ACK_OUT_OF_RESOURCES                       0x03
#define IPOD_ACK_BAD_PARAMETER                          0x04
#define IPOD_ACK_UNKNOWN_ID                             0x05
#define IPOD_ACK_COMMAND_PENDING                        0x06
#define IPOD_ACK_NOT_AUTHENTICATED                      0x07
#define IPOD_ACK_BAD_AUTHENTICATION_VERSION             0x08
#define IPOD_ACK_ACCESSORY_POWER_MODE_REQUEST_FAILED    0x09
#define IPOD_ACK_CERTIFICATE_INVALID                    0x0A
#define IPOD_ACK_CERTIFICATE_PERMISSIONS_INVALID        0x0B
#define IPOD_ACK_FILE_IS_IN_USE                         0x0C
#define IPOD_ACK_INVALID_FILE_HANDLE                    0x0D
#define IPOD_ACK_DIRECTORY_NOT_EMPTY                    0x0E
#define IPOD_ACK_OPERATION_TIMED_OUT                    0x0F
#define IPOD_ACK_COMMAND_UNAVAILABLE                    0x10
#define IPOD_ACK_INVALID_ACCESSORY_RESISTOR             0x11
#define IPOD_ACK_ACCESSORY_NOT_GROUNDED                 0x12
#define IPOD_ACK_SUCCESS_MULTISECTION_DATA              0x13
#define IPOD_ACK_MAXIMUM_ACCESSORY_CONNECTIONS          0x15
#define IPOD_ACK_SessionWriteFailure                    0x17
#define IPOD_ACK_IPOD_OUT_MODE_ENTRY_ERROR              0x18

/**************************************************************************************
 * Section: Apple Device Lingo Support Flags
 **************************************************************************************/

#define IPOD_LINGO_FLAG_GENERAL                         0x00000001ul    // General lingo support flag
#define IPOD_LINGO_FLAG_MICROPHONE                      0x00000002ul    // Microphone lingo support flag
#define IPOD_LINGO_FLAG_SIMPLE_REMOTE                   0x00000004ul    // Simple Remote lingo support flag
#define IPOD_LINGO_FLAG_DISPLAY_REMOTE                  0x00000008ul    // Display Remote lingo support flag
#define IPOD_LINGO_FLAG_EXTENDED_INTERFACE              0x00000010ul    // Extended Interface lingo support flag
#define IPOD_LINGO_FLAG_ACCESSORY_POWER                 0x00000020ul    // Accessory Power lingo support flag
#define IPOD_LINGO_FLAG_USB_HOST_MODE                   0x00000040ul    // USB Host Mode lingo support flag
#define IPOD_LINGO_FLAG_RF_TUNER                        0x00000080ul    // RF Tuner lingo support flag
#define IPOD_LINGO_FLAG_ACCESSORY_EQUALIZER             0x00000100ul    // Accessory Equalizer lingo support flag
#define IPOD_LINGO_FLAG_SPORTS                          0x00000200ul    // Sports lingo support flag
#define IPOD_LINGO_FLAG_DIGITAL_AUDIO                   0x00000400ul    // Digital Audio lingo support flag
#define IPOD_LINGO_FLAG_STORAGE                         0x00001000ul    // Storage lingo support flag
#define IPOD_LINGO_FLAG_IPOD_OUT                        0x00002000ul    // Apple device Out lingo support flag
#define IPOD_LINGO_FLAG_LOCATION                        0x00004000ul    // Location lingo support flag

#define ACCESSORY_INFO_CAPABITITILES                    0x00
#define ACCESSORY_NAME                                  0x01
#define ACCESSORY_MIN_SUPPORT_IPOD_FIRMWARE_VERSION     0x02
#define ACCESSORY_MIN_SUPPORT_LINGO_VERSION             0x03
#define ACCESSORY_FIRMWARE_VERSION                      0x04
#define ACCESSORY_HARDWARE_VERSION                      0x05
#define ACCESSORY_MANUFACTURER                          0x06
#define ACCESSORY_MODEL_NUMBER                          0x07
#define ACCESSORY_SERIAL_NUMBER                         0x08
#define ACCESSORY_INCOMING_MAX_PAYLOAD_SIZE             0x09
#define ACCESSORY_STATUS_TYPE_SUPPORTED                 0x0B

/**************************************************************************************
 * Section: Apple Device Lingo Support Flags
 **************************************************************************************/

// For use with the SetiPodPreferences command.  This value tells the Apple device
// to restore the original settings when the accessory is disconnected.
#define IPOD_PREFERENCES_RESTORE                        0x01
// For use with the SetiPodPreferences command.  This value tells the Apple device
// not to restore the original settings when the accessory is disconnected.
#define IPOD_PREFERENCES_RETAIN                         0x00

// For use with the iPodPreferences.videoOutSetting member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to enable or disable video output, or to as the
// user.
#define IPOD_VIDEO_CLASS_VIDEO_OUT                      0x00
#define IPOD_VIDEO_SETTING_VIDEO_OFF                    0x00    // Disables video output.
#define IPOD_VIDEO_SETTING_VIDEO_ON                     0x01    // Enables video output.
// Deprecated in R41 #define IPOD_VIDEO_SETTING_VIDEO_ASK                0x02    // Asks user for video output status

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to set the screen configuration.  It is not the
// same as setting the aspect ratio.
#define IPOD_VIDEO_CLASS_SCREEN_CONFIGURATION           0x01
#define IPOD_VIDEO_SETTING_SCREEN_FILL                  0x00    // Fill the entire screen.  Image may be cut off.
#define IPOD_VIDEO_SETTING_SCREEN_FIT_TO_EDGE           0x01    // Expand to the screen edge without losing any image information.

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to set the video signal format.
#define IPOD_VIDEO_CLASS_VIDEO_SIGNAL                   0x02
#define IPOD_VIDEO_SETTING_SIGNAL_NTSC                  0x00    // NTSC video format and timing.
#define IPOD_VIDEO_SETTING_SIGNAL_PAL                   0x01    // PAL video format and timing.

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to set the line-out usage.
#define IPOD_VIDEO_CLASS_LINE_OUT                       0x03
#define IPOD_VIDEO_SETTING_LINE_OUT_OFF                 0x00    // Line-out disabled.
#define IPOD_VIDEO_SETTING_LINE_OUT_ON                  0x01    // Line-out enabled.

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to set the video out connection type.
#define IPOD_VIDEO_CLASS_VIDEO_TYPE                     0x08
#define IPOD_VIDEO_SETTING_VIDEO_TYPE_NONE              0x00    // No video.
#define IPOD_VIDEO_SETTING_VIDEO_TYPE_COMPOSITE         0x01    // Composite video (interlaced video only), default.
#define IPOD_VIDEO_SETTING_VIDEO_TYPE_S_VIDEO           0x02    // S-video (interlaced video only).
#define IPOD_VIDEO_SETTING_VIDEO_TYPE_COMPONENT         0x03    // Component Y/Pr/Pb video (interlaced or progressive, depending on the Apple device).

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to enable or disable closed captioning.
#define IPOD_VIDEO_CLASS_CLOSED_CAPTIONING              0x09
#define IPOD_VIDEO_SETTING_CLOSED_CAPTIONING_OFF        0x00    // No closed captioning.
#define IPOD_VIDEO_SETTING_CLOSED_CAPTIONING_ON         0x01    // Closed captioning enabled. Cannot enable subtitles.

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to set the aspect ratio.
#define IPOD_VIDEO_CLASS_ASPECT_RATIO                   0x0A
#define IPOD_VIDEO_SETTING_ASPECT_RATIO_4_3             0x00    // Video aspect ration of 4:3.
#define IPOD_VIDEO_SETTING_ASPECT_RATIO_16_9            0x01    // Video aspect ration of 16:9.

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to enable or disable subtitles.
#define IPOD_VIDEO_CLASS_SUBTITLES                      0x0C
#define IPOD_VIDEO_SETTING_SUBTITLES_OFF                0x00    // No subtitles.
#define IPOD_VIDEO_SETTING_SUBTITLES_ON                 0x01    // Enable subtitles.  Cannot enable closed captioning.

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to enable or disable the alternate audio channel.
#define IPOD_VIDEO_CLASS_ALTERNATE_AUDIO                0x0D
#define IPOD_VIDEO_SETTING_ALTERNATE_AUDIO_OFF          0x00    // Turn off alternate audio channel.
#define IPOD_VIDEO_SETTING_ALTERNATE_AUDIO_ON           0x01    // Turn on alternate audio channel.

// For use with the iPodPreferences.screenConfiguration member of the
// IPOD_APPLICATION_INFORMATION struture and the SetiPodPreferences command.
// This class ID is used to enable or disable video pausing on USB power removal.
#define IPOD_VIDEO_CLASS_PAUSE                          0x0F
#define IPOD_VIDEO_SETTING_PAUSE_OFF                    0x00    // Turn off pause on power removal.
#define IPOD_VIDEO_SETTING_PAUSE_ON                     0x01    // Turn on pause on power removal.

// For use with the SetiPodPreferences command.  This class ID is used to enable
// or disable VoiceOver.  It is represented in the AccessoryCapsToken by the voiceOver bit in
// the accCapsBitmask member of the IPOD_APPLICATION_INFORMATION structure.
#define IPOD_VIDEO_CLASS_VOICEOVER                      0x14
// Renamed in R44 #define IPOD_VIDEO_CLASS_ACCESSIBILITY              0x14
#define IPOD_VIDEO_SETTING_VOICEOVER_OFF                0x00    // Disable VoiceOver.
#define IPOD_VIDEO_SETTING_VOICEOVER_ON                 0x01    // Enable VoiceOver.

// For use with the SetiPodPreferences command.  This class ID is used to enable
// or disable AssistiveTouch.  It is represented in the AccessoryCapsToken by the AssistiveTouch bit in
// the accCapsBitmask member of the IPOD_APPLICATION_INFORMATION structure.
#define IPOD_VIDEO_CLASS_ASSISTIVETOUCH                 0x16
#define IPOD_VIDEO_SETTING_ASSISTIVETOUCH_OFF           0x00    // Disable AssistiveTouch.
#define IPOD_VIDEO_SETTING_ASSISTIVETOUCH_ON            0x01    // Enable AssistiveTouch.

/**************************************************************************************
 * Section: Type Define
 **************************************************************************************/

typedef enum {
    LINGO_GENERAL                                       = 0x00U,
    LINGO_MICROPHONE                                    = 0x01U,
    LINGO_SIMPLE_REMOTE                                 = 0x02U,
    LINGO_DISPLAY_REMOTE                                = 0x03U,
    LINGO_EXTENDED_INTERFACE                            = 0x04U,
    LINGO_ACCESSORY_POWER                               = 0x05U,
    LINGO_USB_HOST_CONTROL                              = 0x06U,
    LINGO_RF_TUNER                                      = 0x07U,
    LINGO_ACCESSORY_EQUALIZER                           = 0x08U,
    LINGO_SPORTS                                        = 0x09U,
    LINGO_DIGITAL_AUDIO                                 = 0x0AU,
    LINGO_STORAGE                                       = 0x0CU,
    LINGO_LOCATION                                      = 0x0EU,
    LINGO_MAX                                           = 0x0FU
} IPOD_LINGOS;

typedef enum {
    IPOD_DR_PLAYBACK_STOPPED                            = 0x00U,
    IPOD_DR_PLAYING                                     = 0x01U,
    IPOD_DR_PLAYBACK_PAUSED                             = 0x02U,
    IPOD_DR_FAST_FORWARD                                = 0x03U,
    IPOD_DR_FAST_REWIND                                 = 0x04U,
    IPOD_DR_END_FAST_FORWARD_OR_REWIND                  = 0x05U,
    IPOD_DR_MAX_PLAYSTATUS                              = 0x7FU
} IPODPlayStatusType;

typedef enum {
    IPOD_STANDARD_OPERATING_MODE,
    IPOD_EXTENDED_INTERFACE_MODE,
    IPOD_FULL_SCREEN_MODE,
    IPOD_OUT_SAFE_ACTION_MODE,
} IPODUIMode;

typedef enum {
    IPOD_AUDIO_HIERARCHY = 0x01U,
    IPOD_VIDEO_HIERARCHY = 0x02U,
} IPODHierarchySection;

typedef enum {
    IPOD_RESTORE_ON_EXIT_STORED,
    IPOD_RESTORE_ON_EXIT_REVERT,
} IPODRestoreOnExitMode;

typedef enum {
    IPOD_CMD_PLAYPAUSE                                  = 0x01U,
    IPOD_CMD_STOP                                       = 0x02U,
    IPOD_CMD_NEXTTRACK                                  = 0x03U,
    IPOD_CMD_PREVIOUSTRACK                              = 0x04U,
    IPOD_CMD_STARTFF                                    = 0x05U,
    IPOD_CMD_STARTREW                                   = 0x06U,
    IPOD_CMD_ENDFFREW                                   = 0x07U,
    IPOD_CMD_NEXT                                       = 0x08U,
    IPOD_CMD_PREVIOUS                                   = 0x09U,
    IPOD_CMD_NEWPLAY                                    = 0x0AU,
    IPOD_CMD_NEWPAUSE                                   = 0x0BU,
} IPODCommandCode;

typedef enum {
    IPOD_SORT_ASC,
    IPOD_SORT_DESC,
    IPOD_SORT_DEFAULT
} IPODSortType;

typedef enum {
    IPOD_DR_STATUS_TRACK_POS_MS                         = 0x00U,
    IPOD_DR_STATUS_PLAYBACK_INDEX                       = 0x01U,
    IPOD_DR_STATUS_CHAPTER_INFO                         = 0x02U,
    IPOD_DR_STATUS_PLAY_STATUS                          = 0x03U,
    IPOD_DR_STATUS_MUTE_AND_VOLUME                      = 0x04U,
    IPOD_DR_STATUS_POWER_AND_BATTERY                    = 0x05U,
    IPOD_DR_STATUS_EQ_SETTING                           = 0x06U,
    IPOD_DR_STATUS_SHUFFLE_SETTING                      = 0x07U,
    IPOD_DR_STATUS_REPEAT_SETTING                       = 0x08U,
    IPOD_DR_STATUS_DATA_AND_TIME                        = 0x09U,
    IPOD_DR_STATUS_ALARM_STATE_AND_DATE                 = 0x0AU,
    IPOD_DR_STATUS_BACKLIGHT                            = 0x0BU,
    IPOD_DR_STATUS_HOLD_SWITCH                          = 0x0CU,
    IPOD_DR_STATUS_SOUND_CHECK                          = 0x0DU,
    IPOD_DR_STATUS_AUDIO_BOOK_SPEED                     = 0x0EU,
    IPOD_DR_STATUS_TRACK_POS_S                          = 0x0FU,
    IPOD_DR_STATUS_MUTE_UI_ABSOLUTE_VOL                 = 0x10U,
    IPOD_DR_STATUS_TRACK_CAPABILITIES                   = 0x11U,
    IPOD_DR_STATUS_PLAYBACK_ENGINE_CONTENTS             = 0x12U,
    IPOD_STATUS_INFO_MAX                                = 0x7FU
} IPOD_DR_STATUS_INFO;

typedef enum {
    DISABLENOTIFICATION                                 = 0x00,
    ENABLENOTIFICATION                                  = 0x01,
    ONE_BYTE_FORMAT                                     = 0x00,
    FOUR_BYTE_FORMAT                                    = 0x01,
    IPOD_EVT_BASIC_PLAY_STATUS                          = (0x01 << 0),
    IPOD_EVT_EXTENDED_PLAY_STATUS_CHANGES               = (0x01 << 1),
    IPOD_EVT_TRACK_INDEX                                = (0x01 << 2),
    IPOD_EVT_TRACK_TIME_OFFSET_MSEC                     = (0x01 << 3),
    IPOD_EVT_TRACK_TIME_OFFSET_SEC                      = (0x01 << 4),
    IPOD_EVT_CHAPTER_INDEX                              = (0x01 << 5),
    IPOD_EVT_CHAPTER_OFFSET_MSEC                        = (0x01 << 6),
    IPOD_EVT_CHAPTER_OFFSET_SEC                         = (0x01 << 7),
    IPOD_EVT_TRACK_UNIQUE_ID                            = (0x01 << 8),
    IPOD_EVT_TRACK_MEDIA_TYPE                           = (0x01 << 9),
    IPOD_EVT_TRACK_LYRICS_READY                         = (0x01 << 10),
    IPOD_EVT_TRACK_CAPABILITIES_CHANGED                 = (0x01 << 11),
    IPOD_EVT_TRACK_PLAYBACK_ENGINE_CONTENTS_CHANGED     = (0x01 << 12),
    IPOD_EVT_MAX                                        = 0x7FFFFFFF
} SetPlayStatusNotification;

typedef enum {
    IPOD_DRE_TRACK_TIME_POS_MSEC                        = (0x01 << 0),
    IPOD_DRE_TRACK_PLAY_INDEX                           = (0x01 << 1),
    IPOD_DRE_CHAPTER_INDEX                              = (0x01 << 2),
    IPOD_DRE_PLAY_STATUS                                = (0x01 << 3),
    IPOD_DRE_MUTE_OR_UI_VOLUME                          = (0x01 << 4),
    IPOD_DRE_POWER_BATTERY                              = (0x01 << 5),
    IPOD_DRE_EQUALIZER_SETTING                          = (0x01 << 6),
    IPOD_DRE_SHUFLE_SETTING                             = (0x01 << 7),
    IPOD_DRE_REPEAT_SETTING                             = (0x01 << 8),
    IPOD_DRE_DATE_TIME_SETTING                          = (0x01 << 9),
    IPOD_DRE_ALARM_SETTING                              = (0x01 << 10),
    IPOD_DRE_BACKLIGHT_LEVEL                            = (0x01 << 11),
    IPOD_DRE_HOLD_SWITCH_STATE                          = (0x01 << 12),
    IPOD_DRE_SOURCE_CHECK_STATE                         = (0x01 << 13),
    IPOD_DRE_AUDIOBOOK_SPEED                            = (0x01 << 14),
    IPOD_DRE_TRACK_TIME_POS_SEC                         = (0x01 << 15),
    IPOD_DRE_MUTE_OR_UI_OR_ABSOLUTE_VOLUME              = (0x01 << 16),
    IPOD_DRE_TRACK_CAPABILITIES                         = (0x01 << 17),
    IPOD_DRE_PLAYBACK_ENGINE_CONTENTS                   = (0x01 << 18),
    IPOD_DRE_MAX                                        = 0x7FFFFFFF
} SetDisplayRemoteEventNotification;

typedef enum {
    IPOD_STATUS_EXTENED_PLAYBACK_STOPPED                = 0x02U,
    IPOD_STATUS_EXTENED_FFW_STARTED                     = 0x05U,
    IPOD_STATUS_EXTENED_REW_STARTED                     = 0x06U,
    IPOD_STATUS_EXTENED_FFW_REW_STOPED                  = 0x07U,
    IPOD_STATUS_EXTENED_PLAYBACK_PLAYING                = 0x0AU,
    IPOD_STATUS_EXTENED_PLAYBACK_PAUSED                 = 0x0BU,
    IPOD_STATUS_EXTENED_MAX_PLAYSTATUS                  = 0x7FU
} IPODPlayStatusTypeExtend;

typedef enum {
    STOPPED                                             = 0x00000000U,
    TRACKCHANGED                                        = 0x00000001U,
    FFSEEKSTOP                                          = 0x00000002U,
    REWSEEKSTOP                                         = 0x00000003U,
    TRACKTIME_OFFSET_MS                                 = 0x00000004U,
    CHAPTERINDEX                                        = 0x00000005U,
    PLAYBACK_STATUS_EXT                                 = 0x00000006U,
    TRACKTIME_OFFSET_S                                  = 0x00000007U,
    CHAPTER_TIME_OFFSET_MSEC                            = 0x00000008U,
    CHAPTER_TIME_OFFSET_SEC                             = 0x00000009U,
    TRACK_UNIQUE_ID                                     = 0x0000000AU,
    TRACK_PLAYBACK_MODE                                 = 0x0000000BU,
    TRACK_LYRICS_READY                                  = 0x0000000CU,
    TRACK_CAPABILITIES_CHANGED                          = 0x0000000DU,
    PLAYBACK_ENGINE_CONTNENTS_CHANGED                   = 0x0000000EU,
    NOTIFICATION_MAX                                    = 0x7FFFFFFFU
} NotificationPlayStatus;

typedef enum {
    IPOD_PIXEL_MONOCHROME                               = 0x01U,
    IPOD_PIXEL_RGB_565_LITTLE                           = 0x02U,
    IPOD_PIXEL_RGB_565_BIG                              = 0x03U,
    IPOD_PIXEL_MAX                                      = 0x7FFFFFFFU
} IPOD_PIXEL_FORMAT;

typedef enum {
    MONOCHROME_2BPP                                     = 0x01,
    RGB565_LITTLE_ENDIAN_16BPP,
    RGB565_BIG_ENDIAN_16BPP
} DisplayPixelFormat;

typedef enum {
    IPOD_NOTI_BITMASK_RESERVED_BIT0                     = (0x01U << 0),
    IPOD_NOTI_BITMASK_RESERVED_BIT1                     = (0x01U << 1),
    IPOD_NOTI_BITMASK_FLOW_CONTROL                      = (0x01U << 2),
    IPOD_NOTI_BITMASK_RADIO_TAGGING_STATUS              = (0x01U << 3),
    IPOD_NOTI_BITMASK_CAMERA_STATUS                     = (0x01U << 4),
    IPOD_NOTI_BITMASK_CHARGING_INFO                     = (0x01U << 5),
    IPOD_NOTI_BITMASK_RESERVED_BIT6                     = (0x01U << 6),
    IPOD_NOTI_BITMASK_RESERVED_BIT7                     = (0x01U << 7),
    IPOD_NOTI_BITMASK_RESERVED_BIT8                     = (0x01U << 8),
    IPOD_NOTI_BITMASK_DATABASE_CHANGED                  = (0x01U << 9),
    IPOD_NOTI_BITMASK_NOWPLAYINGFOCUSAPP_STATUS         = (0x01U << 10),
    IPOD_NOTI_BITMASK_SSESSIONSPACEAVAILABLE_STATUS     = (0x01U << 11),
    IPOD_NOTI_BITMASK_RESERVED_BIT12                    = (0x01U << 12),
    IPOD_NOTI_BITMASK_COMMAND_COMPLETED                 = (0x01U << 13),
    IPOD_NOTI_BITMASK_RESERVED_BIT14                    = (0x01U << 14),
    IPOD_NOTI_BITMASK_STATUS_IPOD_OUT_MODE              = (0x01U << 15),
    IPOD_NOTI_BITMASK_RESERVED_BIT16                    = (0x01U << 16),
    IPOD_NOTI_BITMASK_BT_CONNECTION_STATUS              = (0x01U << 17),
    IPOD_NOTI_BITMASK_RESERVED_BIT18                    = (0x01U << 18),
    IPOD_NOTI_BITMASK_NOWPLAYINGAPPDISPLAYNAME_STATUS   = (0x01U << 19),
    IPOD_NOTI_BITMASK_ASSISTIVETOUCH_STATUS             = (0x01U << 20)
} IPOD_NOTI_BITMASK_STATUS;

/**************************************************************************************
 * Section: Type Struct
 **************************************************************************************/
#ifdef __cplusplus
extern "C"{
#endif

typedef struct receive_data {
    uint8               lingoID;
    uint16              commandID;
    uint16              transID;
    uint16              len;
    uint8               buf[MAX_IAP_PACKET_LEN];
} RECEIVE_DATA_S;

typedef struct {
    IPOD_LINGOS         lingo;
    union {
        uint64          options;
        uint8           option[8];
    };
} IAP_OPTIONS_FOR_LINGO;

typedef struct {
    uint8               lingoID;
    uint8               majorVersionNum;
    uint8               minorVersionNum;
} IAP_IPOD_PROTOCOL_VERSION;

typedef struct {
    uint8               majorVersionNum;
    uint8               minorVersionNum;
    uint8               revisionVersion;
} IAP_IPOD_SOFTWARE_VERSION;

typedef struct {
    uint16              formatID;
    uint8               pixelFormat;
    uint16              imageWidth;
    uint16              imageHeight;
} ArtworkFormat, *pArtworkFormat;

typedef struct {
    uint8               cPixelFormat;
    uint16              sWidth;
    uint16              sHeight;
    uint16              sTopLeftX;
    uint16              sTopLeftY;
    uint16              sBottomRightX;
    uint16              sBottomRightY;
    uint32              uiRowSize;
    uint32              uiTotalSize;
    uint8               *pImageData;
} ArtworkData, *pArtworkData;

typedef struct _IPODPlayStatus {
    uint32              trackLength;
    uint32              trackPostion;
    IPODPlayStatusType  status;
} IPODPlayingStatus;
#ifdef __cplusplus
}
#endif
#endif /* IAP1DEF_H_ */
